//
//  EvaluateResultViewController.m
//  Rong360
//
//  Created by tianliwei on 9/2/14.
//  Copyright (c) 2014 tianliwei. All rights reserved.
//

#import "EvaluateResultViewController.h"
#import "EvalueHistoryViewController.h"
#import "WebViewController.h"
@interface EvaluateResultViewController ()
@property (nonatomic, copy)NSString *min;
@property (nonatomic, copy)NSString *max;
@end

@implementation EvaluateResultViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (IBAction)buttonClicked:(id)sender {
    UIButton *button = (UIButton *)sender;
    switch (button.tag) {
        case 0:{
            self.hidesBottomBarWhenPushed = YES;
            WebViewController *webVC = [[WebViewController alloc]initWithUrl:kRongEvalue title:@"" desc:@"融360贷款"];
            [self.navigationController pushViewController:webVC animated:YES];
            break;
        }
        case 1:{
            [self.navigationController popViewControllerAnimated:YES];
            break;
        }
        case 2:{
            NSString *shareText = [NSString stringWithFormat:@"我在#融360买房助手#中测得我的收入水平能买%@万~%@万的房子，这个应用真的很强大，用了之后，基本不怕被中介忽悠了，你也来试试吧",self.min,self.max];
            [UMSocialData defaultData].extConfig.wxMessageType = UMSocialWXMessageTypeWeb;
            [UMSocialWechatHandler setWXAppId:kWXAppID url:kRong360Host];
            [UMSocialConfig setQQAppId:kTencentID url:kRong360Host importClasses:@[[QQApiInterface class],[TencentOAuth class]]];
//            [UMSocialConfig setShareQzoneWithQQSDK:YES url:kRong360Host importClasses:@[[QQApiInterface class],[TencentOAuth class]]];
            [UMSocialSnsService presentSnsIconSheetView:self
                                                 appKey:kUMSocialKey
                                              shareText:shareText
                                             shareImage:[UIImage imageNamed:kShareIcon]
                                        shareToSnsNames:[NSArray arrayWithObjects:UMShareToSina,UMShareToTencent,UMShareToRenren,UMShareToWechatSession,UMShareToWechatTimeline,UMShareToQQ,nil]
                                               delegate:nil];
            break;
        }
        default:
            break;
    }
}

- (id)initWithMinHouse:(NSString *)min maxHouse:(NSString *)max{
    self = [super init];
    if (self) {
        self.min = min;
        self.max = max;
    }
    return self;
}

- (void)history{
    self.hidesBottomBarWhenPushed = YES;
    EvalueHistoryViewController *evalueHistoryVC = [[EvalueHistoryViewController alloc]init];
    [self.navigationController pushViewController:evalueHistoryVC animated:YES];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    self.title = @"计算结果";
    self.priceLabel.text = [NSString stringWithFormat:@"%@~%@",self.min,self.max];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
